/**
 * Created by caosh on 2018/1/17 0017.
 */
var MineIndex = new Vue({
    el: '#mine-index',
    created: function () { // 页面初始化事件
        this.isLogin = store.get("isLogin");
        if (this.isLogin) {
            this.location = store.get("user").location;
            this.phone = store.get("user").phone;
            this.info = '显示门店名称';
            this.buttonTip = '账号管理 >>';
        }

        this.getConsumerHotline();
        this.getCartProducts();
    },
    data: {
        selected: 'mine',
        consumerHotline: '',
        isLogin: false,
        info: '未登录',
        location: '广州市天河区江海街道452号',
        phone: '13145678910',
        buttonTip: '去登录/注册',
        menuSelected: ''
    },
    watch: {
        selected: function (val, oldVal) {
            if (val != oldVal) { // tabbar切换
                if (val == 'all') {
                    window.location.href = '../product/index.html';
                } else if (val == 'cart') {
                    window.location.href = '../cart/index.html';
                } else if (val == 'mine') {
                    window.location.href = '../mine/index.html';
                } else if (val == 'home') {
                    window.location.href = '../index.html';
                }
            }
        }
    },
    methods: {
        toLogin: function () {
            if (!this.isLogin) {
                window.location.href = '../login.html';
            } else {
                window.location.href = './account.html';
            }
        },
        toShowOrder: function (type) {
            this.menuSelected = type;
            window.location.href = './order.html?type='+type;
        }
    },
    mixins: [SystemMixin, CartMixin]
});